package com.kx.center.email;

import java.util.Map;

import org.apache.velocity.app.VelocityEngine;
import org.springframework.ui.velocity.VelocityEngineUtils;

public class SendMailByVelocityTemplate extends SendMailBase {
	 
	   /**
	    * 依赖的Velocity类
	    */
	   private VelocityEngine velocityEngine;
	  
	   public VelocityEngine getVelocityEngine() {
	      return velocityEngine;
	   }
	 
	   public void setVelocityEngine(VelocityEngine velocityEngine) {
	      this.velocityEngine = velocityEngine;
	   }
	 
	   @Override
	   protected String createMailText(Map model) {
	      String templateLocation =getTemplateLocation();
	          String text =VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, templateLocation, "UTF-8", model);
	      return text;
	   }
	 
	}
